<?php

require_once './include/common.inc.php';

$page_title = 'jans2en furniture - Contact Us - Contact Us';
$menu_id = 13;
//$baner_img='<img height="63" border="0"  width="397" alt="Contact Us" src="css/images/pagetitle_contact.jpg" />';
$postiondiv='<div class="position"><a href="index.php">Home</a> &gt; <span class="position"> Contact Us</span></div>';
$baner_img='<div class="bigtitle">Contact Us</div>';

$webmaster_name = 'test';
$webmaster_email = 'allen@imaker.com.cn';

$email_error = false;
$email_send = false;
getMyParam('act');

// -------------- guideͼƬ start ----------------------------------------
$system_ary = getSystemValue("");
$content_pic = $system_ary['picture_other_contactusen'];
$guide_pic = $system_ary['picture_contact_us'];
if (trim($guide_pic) == "" || !file_exists("./zh/attachments/system/" . $guide_pic)) {
    $guide_pic = './zh/attachments/system/no_guide.gif';
} else {
    $guide_pic = './zh/attachments/system/' . $guide_pic;
}
if (trim($content_pic) == "" || !file_exists("./zh/attachments/system/" . $content_pic)) {
    $content_pic = './zh/attachments/system/no_content.gif';
} else {
    $content_pic = './zh/attachments/system/' . $content_pic;
}
// -------------- guideͼƬ end ------------------------------------------

if ($act == "contact") {
    getMyParam('contactfirstname');
    getMyParam('contactlastname');
    getMyParam('contactaddress');
    getMyParam('contactcity');
    getMyParam('stateid');
    getMyParam('countryid');
    getMyParam('contactpostal');
    getMyParam('contactphone');
    getMyParam('contactemail');
    getMyParam('contactconfirmemail');
    getMyParam('contactpreference');
    //getMyParam('contactdesigner');
    getMyParam('contactcomments');
    getMyParam('vcode');
	
    if (trim($contactlastname) == "" || trim($contactaddress) == "" || trim($contactphone) == "" 
		|| !strstr($contactemail, "@") ||  trim($vcode) == "" || trim($vcode) != $_SESSION['validcode']) {
        $email_error = true;
		if(trim($vcode) != $_SESSION['validcode']){
			$msg = 'Validcode error !';
		}
		else{
			$msg = 'The column with * is required!';
		}
    } else {
	
         //$contactcomments    
			
        require_once './mail/contactus_to_dealer.php';
        sendhtmlmail($from_name,$from_email,$to_name,$to_email,$subject,$content);
        
		$webmaster_name = $system_ary['webmaster_nameen'];
		$webmaster_email = $system_ary['webmaster_emailen'];
        require_once './mail/contactus_to_webmaster.php';
        sendhtmlmail($from_name,$from_email,$to_name,$to_email,$subject,$content);
        
        header("location:contactus.php?act=succeed");
        exit;      
    }
}

if ($act == "succeed") {
    $email_send = true;
}

foreach ($STATE_ARY as $k=>$v) {
    $state_select .= '<option value="' . $k . '" >' . $v . '</option>';
    if ($k==51) {
        $state_select .= '<option value="">--------------------------</option><option value="">CANADIAN PROVINCES</option><option value="">--------------------------</option>';
    }
}
foreach ($COUNTRY_ARY as $k=>$v) {
    $country_select .= '<option value="' . $k . '" >' . $v . '</option>';
}

require_once PrintEot('header');
require_once PrintEot('contactus');
require_once PrintEot('footer');

?>